package com.haierp.service.bi.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.framework.service.impl.SuperServiceImpl;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.haierp.mapper.bi.BiItemMapper;
import com.haierp.mapperBi.BiPurchaseSiteSuccessMapper;
import com.haierp.mapperBi.BiPurchaseStorageMapper;
import com.haierp.mapperBi.BiPurchaseSuccessRateMapper;
import com.haierp.mapperBi.BiUpToNewMapper;
import com.haierp.model.bi.BiItem;
import com.haierp.model.bi.BiPurchaseSiteSuccess;
import com.haierp.model.bi.BiPurchaseStorage;
import com.haierp.model.bi.BiPurchaseSuccessRate;
import com.haierp.model.bi.BiUpToNew;
import com.haierp.service.bi.IBiItemService;

@Service("biItemService")
public class BiItemServiceImpl extends SuperServiceImpl<BiItemMapper, BiItem>  implements IBiItemService{
	@Autowired
	private BiItemMapper biItemMapper;

	@Autowired
	private BiPurchaseSuccessRateMapper biPurchaseSuccessRateMapper;

	@Autowired
	private BiPurchaseSiteSuccessMapper biPurchaseSiteSuccessMapper;
	@Autowired
	private BiPurchaseStorageMapper biPurchaseStorageMapper;
	@Autowired
	private BiUpToNewMapper biUpToNewMapper;

	@Override
	public List<BiUpToNew> selectBiItemListingReportByGmtCreate() {
		EntityWrapper<BiUpToNew> entityWrapper = new EntityWrapper<>();
		entityWrapper.orderBy("dimension_date", false);
		List<BiUpToNew> biUpToNewList = biUpToNewMapper.selectList(entityWrapper);
		return biUpToNewList;
	}
	
	@Override
	public List<BiPurchaseStorage> selectBiStorageSkuReportByGmtCreate(Long companyId) {
		EntityWrapper<BiPurchaseStorage> entityWrapper = new EntityWrapper<>();
		entityWrapper.where("company_id={0}", companyId);
		entityWrapper.orderBy("dimension_date", false);
		return biPurchaseStorageMapper.selectList(entityWrapper);
	}

	@Override
	public List<BiPurchaseSuccessRate> selectBiPurchasingSuccessRateByDay() {
		return biPurchaseSuccessRateMapper.selectBiPurchasingSuccessRateByDay();
	}

	@Override
	public List<BiPurchaseSuccessRate> selectBiPurchasingSuccessRateByMonth() {
		return biPurchaseSuccessRateMapper.selectBiPurchasingSuccessRateByMonth();
	}

	@Override
	public List<BiPurchaseSiteSuccess> selectBiPurchasingBuysiteSuccessByMouth() {
		return biPurchaseSiteSuccessMapper.selectBiPurchaseSiteSuccessByMonth();
	}

	@Override
	public List<BiPurchaseSiteSuccess> selectBiPurchasingBuysiteSuccessByWeek() {
		return biPurchaseSiteSuccessMapper.selectBiPurchaseSiteSuccessByWeek();
	}

	@Override
	public List<BiItem> selectAccessToSmallPrograms() {
		return biItemMapper.selectAccessToSmallPrograms();
	}

	@Override
	public List<BiItem> selectCollectByItemId() {
		return biItemMapper.selectCollectByItemId();
	}
}
